<template>
    <div class="box">
      <img src="../assets/01.gif" alt="" />
      <div class="list">
        <span v-for="(item, index) in arr1" :key="index">{{ item }}</span>
      </div>
      <div class="tasklist" v-for="(item, index) in arr2" :key="index">
        <img :src="item.picture" alt="" />
        <div class="right">
          <div class="one">{{ item.name }}</div>
          <div class="two">{{ item.unit }}</div>
          <div class="four">
            <span>￥{{ item.min_price }}</span>
            <!-- <div>{{ item.promotion_info }}</div> -->
          </div>
        </div>
        <div class="five">
          <button>马上抢</button>
          <p>{{ item.month_saled_content }}</p>
        </div>
      </div>
      <!-- 底部 -->
      <div class="db">
        <span>首页</span>
        <span>爆爆团</span>
        <span>订单</span>
        <span>我的</span>
      </div>
    </div>
  </template>
  
  <script>
  import { tuan_list, tuan_list1 } from "../utils/api.js";
  export default {
    data() {
      return {
        arr: 0,
        arr1: ["正在抢购", "上新预告"],
        arr2: [],
      };
    },
    methods: {
      fun(index) {
        this.arr = index;
        if (index == 0) {
          tuan_list().then((res) => {
            this.arr2 = res.data.list;
          });
        } else if (i == 1) {
          tuan_list1({ status: 0 }).then((res) => {
            this.arr2 = res.data.list;
          });
        }
      },
    },
    mounted() {
      console.log(11111);
      //获取数据
      tuan_list().then((res) => {
        console.log(res);
        this.arr2 = res.data.list;
      });
    },
  };
  </script>
  
  <style lang="css" scoped>
  * {
    margin: 0;
    padding: 0;
  }
  .box img {
    width: 100%;
  }
  .list {
    width: 100%;
    height: 50px;
    padding: 10px 0;
    margin: -5px 0;
    background-image: linear-gradient(to bottom, #ff5429, #fab863);
  }
  .list span {
    font-size: 25px;
    margin: 0px 15px;
    color: rgb(255, 255, 255);
  }
  .tasklist {
    width: 480px;
    height: 200px;
    background-color: rgb(255, 255, 255);
    border-radius: 10px;
    margin: auto;
    display: flex;
  }
  .tasklist img {
    width: 150px;
    height: 150px;
    margin: 20px 20px;
  }
  .tasklist .right {
    margin: 20px 10px;
  }
  .four {
    width: 250px;
    margin: 60px 0;
    display: flex;
    justify-content: space-between;
  }
  button {
    width: 70px;
    height: 30px;
    text-align: center;
    border-radius: 20px;
    background-color: #ff5429;
    color: rgb(255, 255, 255);
    border: 1px solid rgb(255, 255, 255);
  }
  .five {
    margin: 120px -20px;
  }
  .db {
    display: flex;
    width: 100%;
    position: fixed;
    bottom: 0;
    justify-content: space-around;
    align-items: center;
    padding: 15px;
    background-color: #ffffff;
    box-sizing: border-box;
  }
  </style>>
  
  
  